<%@ taglib uri='http://java.sun.com/jsp/jstl/core' prefix='c'%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib uri="/WEB-INF/tlds/helpers.tld" prefix="helpers"%>

<c:if test="${empty view.posts}">
    <p>The blog has no entries.</p>
</c:if>

<c:if test="${not empty view.posts}">

    <c:forEach var="p" items="${view.posts}">
        <div class="post">
            <h2 class="post-list">
                <a href="${request.contextPath}/blog/view/${p.id}/${p.urlString}">
                    <c:out value="${p.title}" />
                </a>
            </h2>
            <div class="post-info">
                    Written by <b><c:out value="${p.author.name}" /></b> on 
                    <b><fmt:formatDate pattern="yyyy-MM-dd" value="${p.date}" /></b>
            </div>
            <div class="post-preview">
                <helpers:FormatWiki>
                    <c:out value="${p.preview}" escapeXml="false" />
                </helpers:FormatWiki>
            </div>
            <div>
                <b>Tags: </b><c:out value="${p.tagString}" />
            </div>
        </div>
    </c:forEach>
</c:if>



